# 动态网站： 查看更多  下拉刷新

#
# import requests
# from util.headers import get_headers_init_user_agent
# url = (f'https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?&ps=10&brush=2')
# res = requests.get(url, headers=get_headers_init_user_agent())
# print(len(res.json()['data']['item']))





# https://www.weather.com.cn/alarm/alarm_list.shtml


import requests
import time
from util.headers import get_headers_init_referer
from util.time_stamp import get_time_stamp
import json




url = f'https://product.weather.com.cn/alarm/grepalarm_cn.php?_={get_time_stamp()}'
res = requests.get(url, headers=get_headers_init_referer("https://www.weather.com.cn/"))
content = res.content.decode('utf-8')[14:-1]
data = json.loads(content)
time.sleep(1)
for item in data['data']:
    print(item)
    detail_url = f'https://product.weather.com.cn/alarm/webdata/{item[1]}?_={get_time_stamp()}'
    detail_res = requests.get(detail_url, headers=get_headers_init_referer('https://www.weather.com.cn/'))
    detail_data = json.loads(detail_res.content.decode('utf-8')[14:])
    print(detail_data)

    break
